package Swing;

import javax.swing.*;
import java.awt.*;
public class JScroll_Demo extends JFrame {
    public JScroll_Demo() {
        Container contentPane = this.getContentPane();

        //文本域
        JTextArea textArea = new JTextArea(20,25);
        textArea.setText("设置文本");
        //scroll面板
        JScrollPane scrollPane = new JScrollPane(textArea);
        contentPane.add(scrollPane);
        setVisible(true);
        setBounds(100,100,400,300);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new JScroll_Demo();
    }
}
